package com.fulihui.wgj.facade.service.autotask;

import com.fulihui.common.error.InvokeServiceException;
import com.fulihui.common.result.rpc.BaseResult;
import com.fulihui.common.result.rpc.SimpleResult;
import com.fulihui.wgj.facade.dto.TemplateAutoLogDTO;
import com.fulihui.wgj.facade.dto.TemplateAutoTaskDTO;
import com.fulihui.wgj.facade.request.PrimaryKeyRequest;
import com.fulihui.wgj.facade.request.autotask.AutoLogPageQueryRequest;
import com.fulihui.wgj.facade.request.autotask.AutoLogQueryRequest;
import com.fulihui.wgj.facade.request.autotask.AutoLogUpdateRequest;
import com.fulihui.wgj.facade.request.autotask.AutoTaskQueryPageRequest;
import com.fulihui.wgj.facade.request.autotask.AutoTaskQueryRequest;
import com.fulihui.wgj.facade.request.autotask.AutoTaskSaveRequest;
import com.fulihui.wgj.facade.request.autotask.CalcAutoCountRequest;
import com.fulihui.wgj.facade.result.autotask.TemplateAutoLogPageResult;
import com.fulihui.wgj.facade.result.autotask.TemplateAutoTaskPageResult;

import java.util.List;

/**
 * 自动发送任务Service
 *
 * @author wang_wx
 * @date 2018-08-02
 */
public interface AutoTaskService {

    /**
     * 预计发送人数
     *
     * @param request
     * @return
     * @throws InvokeServiceException
     */
    SimpleResult<Long> countUserAuto(CalcAutoCountRequest request) throws InvokeServiceException;

    /**
     * 保存自动化发送任务
     *
     * @param request
     * @return
     * @throws InvokeServiceException
     */
    BaseResult saveTask(AutoTaskSaveRequest request) throws InvokeServiceException;

    /**
     * 更新自动化发送任务
     *
     * @param request
     * @return
     * @throws InvokeServiceException
     */
    BaseResult updateTask(AutoTaskSaveRequest request) throws InvokeServiceException;

    /**
     * 查询自动化任务-分页
     *
     * @param request
     * @return
     * @throws InvokeServiceException
     */
    TemplateAutoTaskPageResult pageQueryAutoTask(AutoTaskQueryPageRequest request) throws InvokeServiceException;

    /**
     * 查询自动化任务
     *
     * @param request
     * @return
     * @throws InvokeServiceException
     */
    SimpleResult<List<TemplateAutoTaskDTO>> queryAutoTask(AutoTaskQueryRequest request) throws InvokeServiceException;

    /**
     * 查询自动化任务发送记录
     *
     * @param request
     * @return
     * @throws InvokeServiceException
     */
    SimpleResult<List<TemplateAutoLogDTO>> queryAutoLog(AutoLogQueryRequest request) throws InvokeServiceException;

    /**
     * 查询自动化任务发送记录-分页
     *
     * @param request taskId必传
     * @return
     * @throws InvokeServiceException
     */
    TemplateAutoLogPageResult pageQueryAutoLog(AutoLogPageQueryRequest request) throws InvokeServiceException;

    /**
     * 自动发送记录更新累加--如成功数、失败数、状态等--累加原来的数字
     *
     * @param request
     * @return
     * @throws InvokeServiceException
     */
    BaseResult updateAutoLogAccumulate(AutoLogUpdateRequest request) throws InvokeServiceException;

    /**
     * 自动发送
     *
     * @param request 自动化主键ID
     * @return
     * @throws InvokeServiceException
     */
    BaseResult sendTask(PrimaryKeyRequest request) throws InvokeServiceException;

    /**
     * 查询自动化发送任务-根据主键
     *
     * @param request
     * @return
     * @throws InvokeServiceException
     */
    SimpleResult<TemplateAutoTaskDTO> queryAutoTaskById(PrimaryKeyRequest request) throws InvokeServiceException;
}
